home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
fido
/
RFS275.lha
/
rexx
/
RFSfileguide.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-02-06
|
10KB
|
300 lines
/**/
v="$VER: RFSFileGuide Rexx FileGuide Creator Williamson 54.10"
debug=0
system="Amiga ECS" /* Your system name and address here */
site="FIDONET#1:167/104.0"
listnote="Available files Guide, updated "date()" MAGIC: FILESG"
default=" Sorry, there is no description for this area"||cr||cr
/* ^^ spaces required! */
/* You must create these files */
bbslist="CFG:Browse.CFG" /* filearea config */
htext="CFG:ABOUT.txt" /* System header */
areatext='area.text' /* area description */
/* output files - edit names to suit */
/*allfileslist="MAIL:filelistS/01670104.guide" /* Output File List */ */
allfileslist="T:01670104.guide" /* Output File List */
allfilesarc ="MAIL:filelists/AG167104.LHA" /* Archived Normal List */
filesbbs ="files.bbs" /* area desc and files */
/* WB2 List Lformat parameters */
EXCLUDE='~(area.text|files.bbs|LZTEMP.#?|.info)' /* LIST exclusion parameters */
LFMT_LIST='"%-20N%7L %-9D %C"' /* all files list */
LFMT_BBS='"%-30N %C"' /* areas.bbs */
FLLEN=77 /* list line length */
MARGINALL=39 /* margin for LFMT_LIST - wraptofile prepends a space */
/* used internally */
fileslist="T:ALST-"Pragma('ID') /* temporary all file */
tmpbbs="T:MLST-"Pragma('ID') /* temporary area list */
script="RFSFileGuide";ver="v"||right(v,5);fmvers=script ver
cr='0a'x;lf='0a'x
CSI='9b'x;AOFF=CSI||'0m';BOLD=CSI||'1m';ULINE=CSI||'4m';ITALICS=CSI||'3;40m'
parse var site d '#' z ':' n '/' f '.' p
reqfile='OUTBOUND:'z'.'n'.'f'.'p'.REQ'
if ~show("L", "rexxsupport.library") then
if ~addlib("rexxsupport.library", 0, -30, 0) then do
say "Couldn't access support.library !"
exit 20
end
options results
options failat 20
signal on halt
signal on ioerr
signal on break_c
signal on break_d
call close('STDOUT');call open('STDOUT',"CON:0/10/640/100/"script ver"/CLOSE",'w')
call close('STDIN');call open('STDIN','*','R')
call Pragma("P",-1)
/* Start Area Processing */
if ~open('dlst',bbslist, 'R') then do
call writeln(STDOUT, "Couldn't open fileareas list" bbslist)
signal cleanup
end
if show('p',"ROOFLOG") then address 'ROOFLOG' 'logline' left(time(),5) script': Updating FILE Listing'
call writeln(STDOUT, lf||ITALICS||" "fmvers||lf||" by Robert Williamson 1:167/104.0@fidonet"||AOFF)
/* Start Area Processing */
call writeln(STDOUT, 'Reading file area configuration')
area=1
do while ~eof('dlst')
call writech(STDOUT,'.')
blstln=readln('dlst')
if blstln="" then iterate
parse var blstln Number.area '"' Path.area '"' '"' Name.area '"'
if upper(strip(dequote(Path.area)))="NULL:" then iterate
area=area+1
end /*eof*/
call close('dlst')
areas=area-1
call writeln(STDOUT,lf'Found 'areas' file areas')
/* open all file listing, put title, date and system header */
call writeln(STDOUT,ULINE||"Generating AmigaGuide Files Listing for "system||AOFF||cr)
if debug then call writeln(STDOUT,'Adding date/version header to 'fileslist)
gbuf=""
gbuf=gbuf'@DataBase 'system' AmigaGuide Listing'cr
gbuf=gbuf'@Node Main "About 'system' and AmigaGuide Listing"'cr||cr
gbuf=gbuf" "fmvers" by Robert Williamson 1:167/104.0@fidonet"cr
gbuf=gbuf" guidelisting for" system delstr(space(date(), 1, "-"), 8, 2) time()||cr||cr
gbuf=gbuf' @{"About 'system' and this Guide" link ABOUT}'cr
gbuf=gbuf' @{"File Areas" link AREAS}'cr
gbuf=gbuf' @{"File Requests" link REQS}'cr'@EndNode'cr||cr
gbuf=gbuf'@Node REQS "File Requests"'cr||cr
gbuf=gbuf'Clicking on a filename gadget will cause that file name to be written or'cr
gbuf=gbuf'appended to a REQ file. The REQ file will be placed in the Assigned OUTBOUND:,'cr
gbuf=gbuf'with the filename 'reqfile'. If the Assign OUTBOUND: does not exist, you will get'cr
gbuf=gbuf'a "Please Insert Volume: requester.'cr||cr
gbuf=gbuf'If you are a Terminal user and are calling a system running a Porticus Shelter'cr
gbuf=gbuf'Front-End, you may wish to rename the REQ file to Your_Name.GRAB. This will'cr
gbuf=gbuf'permit you to automate your GRAB requests.'cr||cr
gbuf=gbuf'@EndNode'cr
gbuf=gbuf'@Node ABOUT "About 'system' and this Guide"'cr||cr
call open('tbl', fileslist, 'W')
call writech('tbl',gbuf||cr);drop gbuf
call close('tbl')
if ~exists('htext') then do
if debug then call writeln(STDOUT,'Adding headerfile' htext 'to 'fileslist)
com='Type >> "'fileslist'" "'htext'"'
address COMMAND com
end
call open('tbl', fileslist, 'A')
call writech('tbl','@EndNode'cr)
call close('tbl')
gbuf=""
do area=1 to areas by 2
a=area
gbuf=gbuf' @{" 'left_justify(name.a,35)' " link AREA'number.a'}'
a=a+1
if a<areas+1 then gbuf=gbuf' @{" 'left_justify(name.a,35)' " link AREA'number.a'}'||cr
end
call open('tbl', fileslist, 'A')
call writech('tbl','@Node AREAS "File Area Descriptions"'cr||gbuf||cr'@EndNode'cr)
drop gbuf
call close('tbl')
do area=1 to areas
areadir=addslash(dequote(Path.area))
if debug then call writeln(STDOUT,'Updating area' Name.area)
call open('tbl', fileslist, 'A')
call writech('tbl','@Node AREA'number.area '"'name.area'"'cr)
call close('tbl')
call listandsort(areadir,areadir||filesbbs,LFMT_BBS)
call addareatext(areadir,areadir||filesbbs,areatext,areadir||filesbbs,'prepend')
call addheaders()
call listandsort(areadir,tmpbbs,LFMT_LIST)
if ~open('ifn',tmpbbs,'R') then do
call writeln(STDOUT,'wraptofile:Cannot open 'tmpbbs)
signal cleanup
end
if ~open('ofn',fileslist,'A') then do
call writeln(STDOUT,'wraptofile:Cannot append Area List to 'fileslist)
signal cleanup
end
do while ~eof('ifn')
line=readln('ifn')
if left(line,1) ~= " " then call writech('ofn',' 'wrap_line(line,FLLEN,MARGINALL))
else call writech('ofn',line||cr)
end /*eof */
call writech('ofn','@EndNode'cr)
call close('ifn')
call close('ofn')
end
/*address COMMAND 'Copy' fileslist allfileslist */
call rename(fileslist,allfileslist)
address COMMAND 'FileNote "'allfileslist'" "'listnote'"'
call writeln(STDOUT,'Archiving 'allfileslist' as 'allfilesarc)
call delete(allfilesarc)
address COMMAND 'lha -2 u "'allfilesarc'" "'allfileslist'"'
address COMMAND 'FileNote "'allfilesarc'" "'listnote'"'
call writeln(STDOUT,' File Listing completed')
cleanup:
call delete(allfileslist)
call delete(tmpbbs)
exit 0
listandsort:
/* list <tdir> with <lfmt> and sort to <tfile> */
tdir=arg(1);tfile=arg(2);lfmt=arg(3)
las='PIPE LIST 'tdir||exclude' FILES NOHEAD LFORMAT 'lfmt' | SORT In: 'tfile
address command las
return 0
/* prepend area.text to files.bbs */
/* addareatext(areadir,files.bbs,area.text,output) */
/* addareatext(areadir,files.bbs,area.text,output,where) */
/* where= append or prepend(DEFAULT) */
/* example: */
/* call addareatext(Path.area,availlist,areatext,availlist) */
addareatext:
descfile=addslash(dequote(arg(1)))||arg(3)
inlist=arg(2);tolist=arg(4);where=arg(5)
if ~exists(inlist) then do
call writeln(STDOUT,'addareatext: cannot find 'inlist)
return 20
end
if ~exists(descfile) then do
call writeln(STDOUT,'addareatext: cannot find 'descfile' using 'default)
if where='append' then do
call open('ds',descfile,'A')
call writech('ds',default)
end;else do
call open('ds',descfile,'W')
call writech('ds',default)
end
call close('ds')
end
if where='append' then call join(inlist,descfile,tolist)
else call join(descfile,inlist,tolist)
return 0
wrap_line:
text=arg(1)
right_edge=arg(2) /* line length */
left_edge=arg(3)+2 /* margin */
new_text=''
do while length(text) > 0
broken_word=0
if length(text) < right_edge then do
new_text=new_text||text||'0a'x
text=''
end;else do
temp_text=strip(text,l)
diff=length(text) - length(temp_text)
first_break=lastpos(' ',temp_text,right_edge - diff)
break_point=first_break + diff
if left_edge=break_point then do
break_point=right_edge - 1
broken_word=1
end
new_text=new_text||strip(left(text,break_point),t)
if broken_word then do
new_text=new_text||'-'
end
new_text=new_text||'0a'x
text=copies(' ',left_edge)||strip(right(text,length(text) - break_point),l)
end
end
parse var new_text fn therest
return '@{"'fn'" System "Echo >>'reqfile fn'"}' therest
/*
join -- a 'front end' for join. Fixes a problem with join.
uses a tempfile if target filename is same as one to cat
*/
join:
x=arg(1)' 'arg(2)' 'arg(3)
temp='arexxtempfile'
do i=1 to (words(x)-1)
if word(x,i)=word(x,words(x)) then do
oops=word(x,words(x))
x=delword(x,words(x))||'TO '||temp
address COMMAND 'Join' x
address COMMAND 'Copy 'temp' 'oops
call delete(temp)
return 0
end
end
x=arg(1)' 'arg(2)' TO 'arg(3)
address COMMAND 'Join' x
return 0
addslash:
curr=arg(1)
select
when right(curr, 1)=":" then nop
when right(curr, 1)="/" then nop
otherwise curr=curr"/"
end
return curr
/* a useful procedure by Walt Sullivan */
dequote:
parse arg thing
parse var thing '"' unq_thing '"'
if unq_thing ~= "" then return unq_thing
return thing
halt:
ioerr:
break_c:
break_d:
call writech(stdout,cr)
call cleanup()
exit 10
addheaders:
call writeln(STDOUT,'Appending 'areadir Number.area Name.area' to 'fileslist)
tbuf=CR||CR||center("AREA: "Number.Area,79)||CR||center(Name.Area,79)||CR||CR
if debug then call writeln(STDOUT,'Adding Area Banner to 'fileslist)
if ~open('tbl', fileslist, 'A') then do
call writeln(STDOUT,'Cannot append Area Header to 'fileslist)
signal cleanup
end
call writech('tbl',tbuf)
close('tbl');drop tbuf
if exists(areadir||areatext) then do
if debug then call writeln(STDOUT,'Adding Area description to 'fileslist)
com='Type >> "'fileslist'" "'areadir||areatext'"'
address COMMAND com
end
return
/* align text to left of field adding spaces or trucating on right to fit */
left_justify:
if length(arg(1)) > arg(2) then return (left(arg(1),arg(2)))
else return (arg(1)||copies(" ",arg(2)-length(arg(1))))